#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Project: spd-sxmcc


"""
@author: lyndon
@time Created on 2019/2/7 7:13
@desc
"""
__author__ = 'Eva_J'
import multiprocessing
import time


def func(msg):
    print("msg : ", msg)
    time.sleep(3)
    print("end")
    return "multi_result : " + msg


if __name__ == "__main__":
    pool = multiprocessing.Pool(processes=4)
    result = []
    for i in range(3):
        msg = "hello %d" % (i)
        multi_result = pool.apply_async(func, (msg,))
        result.append(multi_result)
    pool.close()
    pool.join()
    for res in result:
        print(res.get())
    print("have done.")
